﻿
namespace FileZillaConfig.ConfigClasses
{
    public class Autoban
    {
        private bool _enabled;
        private int _attempts;
        private int _time;
        private int _type;

        /// <summary>
        /// Unknown behaviour.
        /// </summary>
        public int type
        {
            get { return _type; }
            set { _type = value; }
        }


        /// <summary>
        /// Number of hours to ban (1 - 999)
        /// </summary>
        public int Time
        {
            get { return _time; }
            set {
                if (value >= 1 && value <= 999)
                {
                    _time = value;
                }
                else
                {
                    throw new System.Exception("Value must be integer between 1 and 999");
                }    
            }
        }


        /// <summary>
        /// Number of failed attempts within 1 hour (min. 10)
        /// </summary>
        public int Attempts
        {
            get { return _attempts; }
            set {
                if (value >= 10)
                {
                    _attempts = value; 
                }
                else
                {
                    throw new System.Exception("Value must be integer of value minimum 10");
                }
            }
        }


        /// <summary>
        /// Enable autoban
        /// </summary>
        public bool Enabled
        {
            get { return _enabled; }
            set { _enabled = value; }
        }

    }
}
